<template>
  <div>

  </div>
</template>

<script>

import {getGamePathByCode} from "@/api/game/gamePromote";
import {appSource} from "../../util/util";

export default {
  name: "download",
  data() {
    return {
      code: '',
      path: '',
    }
  },

  components: {},
  created() {
    console.log("下载页面")
    document.title = '游戏下载'
  },
  mounted() {
    let rc = this.$route.query.rc
    if (!rc || rc.indexOf('admin')==-1) {
      this.$message({
        type: "error",
        message: '地址无效！'
      });
      return
    }
    this.code = this.$route.query.code;
    let osType = appSource();
    getGamePathByCode(this.code, osType).then(res => {
      let data = res.data.data;
      this.path = data.gameUrl
      if (osType == 1) {
        window.location.href = "itms-services://?action=download-manifest&amp;url=" + this.path
      } else {
        window.location.href = this.path
      }
    })
  },
  methods: {}
}
</script>

<style scoped>

</style>
